﻿<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>后台管理系统</title>
    <meta name="author" content="DeathGhost"/>
    <link rel="stylesheet" type="text/css" href="Css/style.css">
    <!--[if lt IE 9]>
    <script src="Scripts/html5.js"></script>
    <![endif]-->
    <script src="Scripts/jquery.js"></script>
    <script src="Scripts/jquery.mcustomscrollbar.concat.min.js"></script>
    <script>
        (function ($) {
            $(window).load(function () {

                $("a[rel='load-content']").click(function (e) {
                    e.preventDefault();
                    var url = $(this).attr("href");
                    $.get(url, function (data) {
                        $(".content .mCSB_container").append(data); //load new content inside .mCSB_container
                        //scroll-to appended content
                        $(".content").mCustomScrollbar("scrollTo", "h2:last");
                    });
                });

                $(".content").delegate("a[href='top']", "click", function (e) {
                    e.preventDefault();
                    $(".content").mCustomScrollbar("scrollTo", $(this).attr("href"));
                });

            });
        })(jQuery);
    </script>
</head>
<body>
<!--header-->
<header>
    <h1><img src="Picture/admin_logo.png"/></h1>
    <ul class="rt_nav">
        <li><a href="#" class="website_icon">站点首页</a></li>
        <li><a href="#" class="admin_icon">DeathGhost</a></li>
        <li><a href="#" class="clear_icon">清除缓存</a></li>
        <li><a href="#" class="set_icon">账号设置</a></li>
        <li><a href="login.jsp" class="quit_icon">安全退出</a></li>
    </ul>
</header>
<!--aside nav-->
<!--aside nav-->
<aside class="lt_aside_nav content mCustomScrollbar">
    <h2><a href="index.jsp">起始页</a></h2>
    <ul>
        <li>
            <dl>
                <dt>商品信息</dt>
                <!--当前链接则添加class:active-->
                <dd><a href="product_list.jsp">商品列表</a></dd>
                <dd><a href="recycle_bin.jsp">商品回收站</a></dd>
            </dl>
        </li>
        <li>
            <dl>
                <dt>订单信息</dt>
                <dd><a href="order_list.jsp" class="active">订单列表</a></dd>
            </dl>
        </li>
        <li>
            <dl>
                <dt>配送</dt>
                <dd><a href="express_list.jsp">配送方式</a></dd>
            </dl>
        </li>
        <li>
            <dl>
                <dt>在线统计</dt>
                <dd><a href="discharge_statistic.jsp" >流量统计</a></dd>
                <dd><a href="sales_volume.jsp">销售额统计</a></dd>
            </dl>
        </li>
        <li>
            <p class="btm_infor">© DeathGhost.cn 版权所有</p>
        </li>
    </ul>
</aside>

<section class="rt_wrap content mCustomScrollbar">
    <div class="rt_content">
        <div class="page_title">
            <h2 class="fl">订单列表</h2>
            <a class="fr top_rt_btn add_icon" href="product_detail.jsp">添加商品</a>
        </div>
        <form action="OrdersServlet" method="get">
            <section class="mtb">
                <select class="select" name="state" id="state">
                    <option value="0">订单状态</option>
                    <c:if test="${page.list==null}">
                        <c:redirect url="OrdersServlet?pageNo=1&orderNumder=&state=0"/>
                    </c:if>
                    <c:forEach items="${sessionScope.OrderStatus}" var="o">
                        <option value="${o.stateID}">${o.stateName}</option>
                    </c:forEach>
                </select>
                <input type="text" class="textbox textbox_225" placeholder="输入订单编号或收件人姓名/电话..." name="orderNumder"/>
                <input type="button" value="查询" class="group_btn" id="group_btn"/>
            </section>
            <table class="table">
                <tr>
                    <th>订单编号</th>
                    <th>收件人</th>
                    <th>联系电话</th>
                    <th>收件人地址</th>
                    <th>订单金额</th>
                    <th>配送方式</th>
                    <th>操作</th>
                </tr>
                <c:forEach items="${page.list}" var="orders">
                    <tr>
                        <td class="center">${orders.orderNumder}</td>
                        <td>${orders.consigneeName}</td>
                        <td>${orders.consigneephoone}</td>
                        <td>
                            <address>${orders.site}</address>
                        </td>
                        <td class="center"><strong class="rmb_icon">${orders.upmoney}</strong></td>
                        <td class="center">${orders.dName}</td>
                        <td class="center">
                            <a href="OrderInfoServlet?id=${orders.orderID}" title="查看详情订单" class="link_icon" >查看详情订单</a>
                        </td>
                    </tr>
                </c:forEach>
            </table>
        </form>
        <aside class="paging">
            <a id="dyy">第一页</a>
            <c:if test="${page.pageNo>1}">
                <a id="syy">上一页</a>
            </c:if>
            <c:if test="${page.totalPage<=0}">
                <a>...</a>
            </c:if>
            <c:if test="${page.totalPage>0}">
                <a>${page.pageNo}</a>
            </c:if>
            <c:if test="${page.pageNo<page.totalPage}">
                <a id="xyy">下一页</a>
            </c:if>
            <a id="zhyy">最后一页</a>
        </aside>
    </div>
</section>
</body>
</html>
<script src="jquery.js"></script>
<script>
    $("#state").val(${state});
    $("#orderNumder").val(${orderNumder});
    $("#group_btn").click(function () {
        var state = $("#state").val();//状态
        var orderNumder = $("#orderNumder").val();//订单号
        if (orderNumder == "" || orderNumder == undefined) {
            location.href = "OrdersServlet?pageNo=1&orderNumder=&state=" + state;
        } else {
            location.href = "OrdersServlet?pageNo=1&orderNumder=" + orderNumder + "&state=" + state;
        }
    });
    //第一页
    $("#dyy").click(function () {
        var state = $("#state").val();//状态
        var orderNumder = $("#orderNumder").val();//订单号
        if (orderNumder == "" || orderNumder == undefined) {
            location.href = "OrdersServlet?pageNo=1&orderNumder=&state=" + state;
        } else {
            location.href = "OrdersServlet?pageNo=1&orderNumder=" + orderNumder + "&state=" + state;
        }
    });
    //最后一页
    $("#zhyy").click(function () {
        var state = $("#state").val();//状态
        var orderNumder = $("#orderNumder").val();//订单号

        if (orderNumder == "" || orderNumder == undefined) {
            location.href = "OrdersServlet?pageNo=${page.totalPage}&orderNumder=&state=" + state;
        } else {
            location.href = "OrdersServlet?pageNo=${page.totalPage}&orderNumder=" + orderNumder + "&state=" + state;
        }
    });
    //下一页
    $("#xyy").click(function () {
        var state = $("#state").val();//状态
        var orderNumder = $("#orderNumder").val();//订单号

        if (orderNumder == "" || orderNumder == undefined) {
            location.href = "OrdersServlet?pageNo=${page.pageNo+1}&orderNumder=&state=" + state;
        } else {
            location.href = "OrdersServlet?pageNo=${page.pageNo+1}&orderNumder=" + orderNumder + "&state=" + state;
        }
    });
    //上一页
    $("#syy").click(function () {
        var state = $("#state").val();//状态
        var orderNumder = $("#orderNumder").val();//订单号

        if (orderNumder == "" || orderNumder == undefined) {
            location.href = "OrdersServlet?pageNo=${page.pageNo-1}&orderNumder=&state=" + state;
        } else {
            location.href = "OrdersServlet?pageNo=${page.pageNo-1}&orderNumder=" + orderNumder + "&state=" + state;
        }
    });
</script>